{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python382jvsc74a57bd01b69bd087aa8abd614583c53268aa6b11c2c1c046d6f6b67ad1f1c711f8a952b",
   "display_name": "Python 3.8.2 64-bit"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "13147507057\n"
     ]
    }
   ],
   "source": [
    "\n",
    "import random\n",
    " \n",
    "def getAPhoneNumber():\n",
    "    second = random.choice([3,4,5,7,8])\n",
    "    third = {\n",
    "        3:random.randint(0,9),\n",
    "        4:random.choice([5,7,9]),\n",
    "        5:random.choice([i for i in range(10) if i != 4]),\n",
    "        7:random.choice([i for i in range(9) if i != 4 ]),\n",
    "        8:random.randint(0,9),\n",
    "    }[second]\n",
    "    \n",
    "    last = \"\".join(str(random.randint(0,9)) for i in range(8))\n",
    "    return \"1{}{}{}\".format(second,third,last)\n",
    " \n",
    "print(getAPhoneNumber())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "'nnnnnn'"
      ]
     },
     "metadata": {},
     "execution_count": 9
    }
   ],
   "source": [
    "chr(random.randint(97,122))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "7ac66c0f148de9519b8bd264312c4d64\n"
     ]
    }
   ],
   "source": [
    "from hashlib import md5\n",
    "hash_val = md5(\"abcdefg\".encode('utf-8')).hexdigest()\n",
    "print(hash_val)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "32"
      ]
     },
     "metadata": {},
     "execution_count": 12
    }
   ],
   "source": [
    "len('7ac66c0f148de9519b8bd264312c4d64')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}